#include <iostream>
#include <memory>
#include <string>
#include <thread>
#include <grpcpp/grpcpp.h>
#include "../protos/RobotPose.grpc.pb.h"
#include "../atomic_include/RobotPose.h"


void getRobotPose_func(RequestSignal_2* request, RobotResult* reply);



class RobotPose_Service_ServerImpl final : public ::RobotPose_Package::RobotPose_Service::Service {
public:
    RobotPose_Service_ServerImpl() {} 
    

    ::grpc::Status getRobotPose(::grpc::ServerContext* context, 
            const ::RobotPose_Package::RequestSignal_2* request, 
                ::RobotPose_Package::RobotResult* reply) override {

        RequestSignal_2 RobotPose_Request_t;
        RobotResult RobotPose_Reply_t;

        
        
        RobotPose_Request_t.signal = request->signal();
        
        

        /******************************************************************/
        getRobotPose_func(&RobotPose_Request_t, &RobotPose_Reply_t);

        /******************************************************************/

        reply->Clear(); // clear reply message
        
        
        reply->set_robot_id(RobotPose_Reply_t.robot_id);
        
        
        
        reply->set_x(RobotPose_Reply_t.x);
        
        
        
        reply->set_y(RobotPose_Reply_t.y);
        
        
        
        reply->set_z(RobotPose_Reply_t.z);
        
        
        
        reply->set_roll(RobotPose_Reply_t.roll);
        
        
        
        reply->set_pitch(RobotPose_Reply_t.pitch);
        
        
        
        reply->set_yaw(RobotPose_Reply_t.yaw);
        
        
        
        reply->set_return_type(RobotPose_Reply_t.return_type);
        
        
        std::cout << "This is Method = getRobotPose,   ServiceName = RobotPose_Service" << std::endl;
        return grpc::Status::OK;
    }

    
};